-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phong skinning #444
Phong skinning #444
Conversation
Signed-off-by: Squareys <squareys@googlemail.com>
Signed-off-by: Squareys <squareys@googlemail.com>
Signed-off-by: Squareys <squareys@googlemail.com>
Signed-off-by: Squareys <squareys@googlemail.com>
Signed-off-by: Squareys <squareys@googlemail.com>
@@ -913,43 +917,55 @@ void CompileGLTest::packedAttributes() { | |||
const PackedVertex vertexData[]{ | |||
{Math::pack<Vector3s>(Vector3{-0.75f, -0.75f, -0.35f}), | |||
Math::pack<Vector3s>(Vector3{-0.5f, -0.5f, 1.0f}.normalized()), | |||
Math::pack<Vector2us>(Vector2{0.0f, 0.0f}), 0x00ff00_rgb, 13562}, | |||
Math::pack<Vector2us>(Vector2{0.0f, 0.0f}), 0x00ff00_rgb, 13562, | |||
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to have a non-trivial order, otherwise the test would pass also if it was doing matrices[i]
instead of matrices[jointIds[i]]
for(; i != JOINTS_PER_VERTEX && i != 4; ++i) | ||
skinMatrix += weights[i]*jointMatrices[jointIds[i]]; | ||
#if JOINTS_PER_VERTEX > 4 | ||
for(i = 0; i != JOINTS_PER_VERTEX - 4 && i != 4; ++i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be i != 8
.
@@ -155,11 +186,25 @@ out highp vec3 cameraDirection; | |||
#endif | |||
|
|||
void main() { | |||
#ifdef SKINNING | |||
mat4 skinMatrix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be initialized with weights[0]*jointMatrices[jointIds[0]]
. (And i should then start at 1)
The shader code is merged as part of 89a6eb2. The shader code changed quite significantly since then so I was mostly just cherry-picking interesting bits from here, nevertheless -- thanks for the initial code, saved me a lot of time. The support is now extended to Flat and MeshVisualizer shaders as well, and works in instanced and multi-draw scenarios too. The |
Hi @mosra !
As mentioned in #441 , here's the split-off of the Phong implementation.
Best,
Jonathan